import java.util.Arrays;

/**
 * 重新分装苹果
 *
 * @USER: Administrator
 * @DATE: 2024/9/22 下午12:08
 * @VERSION: 1.0.0
 */
public class LC3074 {
    public static void main(String[] args) {

    }

    public int minimumBoxes(int[] apple, int[] capacity) {
        Arrays.sort(capacity);
        int sum = 0;
        for (int j : apple) {
            sum += j;
        }
        int count = 0;
        for (int i = capacity.length - 1; i >= 0; i--) {
            sum -= capacity[i];
            count++;
            if (sum <= 0) {
                break;
            }
        }
        return count;
    }

}
